home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_329 / cpu / asm / cpu.asm < prev   
Assembly Source File  |  1992-05-06  |  4KB  |  135 lines

  1. ; WhatCPU.asm
  2. ;
  3. ; Actually a hand conversion of WhatCPU.c by Dave Haynie
  4. ;    done by Ethan Dicks 14-mar-88
  5. ;    beautification done by Ethan Dicks 14-Dec-88
  6. ;
  7. ; I did this as my first project in assembler.  Documentation is very
  8. ; scanty regarding the use of structures in assembler.  I got the magic
  9. ; offset into the ExecBase structure for the AttnFlags word by compiling
  10. ; Dave Haynie's program with Lattice, on a friend's machine, then
  11. ; running omd on the .o file.
  12. ;
  13. ; V 1.1
  14. ;  Since I got a copy of the C-A v1.0 Macro Assembler, and the assembler
  15. ;  includes with Lattice V4.01, I have been able to convert this program
  16. ;  over to the niceties of INCLUDE files.  I also too the opportunity to
  17. ;  streamline the code to the tune of about 40 bytes, making this one of
  18. ;  the smallest useful utilities.
  19. ;
  20. ; V 1.2 (07-Mar-1989)
  21. ;  The text strings have been changed slightly, to save about 12 bytes.
  22. ;  Other than that, there have been no significant changes.
  23. ;
  24. ; This program was most recently compiled on:
  25. ;
  26. ; assem
  27. ;    MC68000 Macro Assembler  Version 10.178
  28. ;    Copyright (C) 1985 by Tenchstar Ltd., T/A Metacomco.
  29. ;    All rights reserved.
  30. ;
  31. ; Blink
  32. ;    Blink - Version 5.0
  33. ;    Copyright (c) 1988 Lattice, Inc.  All Rights Reserved.
  34. ;
  35. ;
  36. ; To recompile:
  37. ;    assem WhatCPU.asm -i your_include_directory -o WhatCPU.o
  38. ;    blink WhatCPU.o
  39. ;
  40. ; This code is freely redistributable, although not pretty.
  41. ;
  42.     section    code
  43.  
  44.  
  45.         include    "exec/execbase.i"
  46.         include "libraries/dos.i"
  47.         include "libraries/dos_lib.i"
  48.         include "exec/funcdef.i"
  49.         include "exec/exec_lib.i"
  50.  
  51. AbsExecBase    equ    4
  52.  
  53. start:        movea.l    AbsExecBase,a6        ;put ptr to ExecBase in a6
  54.         lea    dos_name(pc),a1        ;point to library name
  55.         moveq.l    #0,d0            ;pick any version
  56.         jsr    _LVOOpenLibrary(a6)    ;open dos.library
  57.         movea.l    d0,a5            ;save DosBase in A5
  58.         jsr    _LVOOutput(a5)      ;get OutputHandle into D0
  59.         move.l    d0,d5            ;save OutputHandle in D5
  60. ;
  61. ; print title message
  62. ;
  63.         move.l    #header,d2        ;print intro message
  64.         moveq.l    #25,d3            ; 25 chars long
  65.         bsr.s    print           ;output string
  66. ;
  67. ; check processor type bits
  68. ;
  69.         btst.b    #AFB_68020,AttnFlags+1(a6) ;check 68020 bit
  70.         beq.s    not68020        ;nope... not set
  71.         move.l    #mc68020,d2        ;point to "20"
  72.         moveq.l    #2,d3            ; 2 chars long
  73.         bra.s    break            ;print processor type and
  74.                         ;  check co-processor bit
  75. ;
  76. not68020:    btst.b    #AFB_68010,AttnFlags+1(a6) ;check 68010 bit
  77.         beq.s    not68010        ;nope... not set
  78.         move.l    #mc68010,d2        ;point to "10"
  79.         moveq.l    #2,d3            ; 6 chars long
  80.         bra.s    break            ;print processor type and
  81.                         ; check co-processor bit
  82. ;
  83. not68010:    move.l    #mc68000,d2        ;must be 68000; print it
  84.         moveq.l    #2,d3            ; 2 chars long
  85.                         ;print processor type and
  86.                         ; check co-processor bit
  87.                         ;
  88.                         ; *** WARNING ***
  89.                         ;*  Fall through *
  90.                         ; ***************
  91. ;
  92. break:        bsr.s    print            ;output processor string
  93.  
  94.         btst.b    #AFB_68881,AttnFlags+1(a6) ;check 68881 bit
  95.         beq.s    not68881        ;nope... not set
  96.         move.l    #mc68881,d2        ;print " 68881"
  97.         moveq.l    #6,d3            ; 6 chars long
  98.         bsr.s    print
  99. not68881:
  100. ;
  101. ; print <CR> at end of line
  102. ;
  103.         move.l    #cr,d2            ;finish off with <crlf>
  104.         moveq.l    #2,d3            ; 2 chars long
  105.         bsr.s    print   
  106. ;
  107. ; clean up and exit
  108. ;
  109.         movea.l    a5,a1            ;get DosBase
  110.         jsr    _LVOCloseLibrary(a6)    ;close dos.library
  111.         moveq.l    #0,d0            ;set return code
  112.         rts                ;go home
  113. ;
  114. ; subroutines
  115. ;
  116. print:        move.l  d5,d1            ;set output handle
  117.         jsr     _LVOWrite(a5)        ;write string to console
  118.         rts                ;go back
  119. ;
  120. ; data section
  121. ;
  122.  
  123. ;
  124. ; byte aligned data
  125. ;
  126. dos_name:    DOSNAME
  127. header:        dc.b    'System Configuration: 680'
  128. mc68020:    dc.b    '20'
  129. mc68010:    dc.b    '10'
  130. mc68000:    dc.b    '00'
  131. mc68881:    dc.b    ' 68881'
  132. cr:        dc.b    13,10
  133.  
  134.         end
  135.